Log In  
BBS > Lexaloffle Community Superblog
This is a combined feed of all Lexaloffle user blogs. For Lexaloffle-related news, see @zep's blog.

All | Following | PICO-8 | Voxatron | General | Off-site
[ :: Read More :: ]

I wrote this library to cut down on the number of tokens taken up by large tables with string data, e.g. for dialogue text/translations/etc. Most helpful if those tokens are using a lot of your tokens (i.e. more than 150), since the library itself takes up 139 tokens. But all your table declarations can be reduced to 5 tokens each!

Here's an example of what your code can look like.

Before:

my_table = {
  hello='world',
  nested={
    some='data\'s nested',
    inside_of='here'
  },
  'and',
  'indexed',
  'data',
  { as='well' }
}

After:

function table_from_string(str)
  local tab, is_key = {}, true
  local key,val,is_on_key
  local function reset()
    key,val,is_on_key = '','',true
  end
  reset()
  local i, len = 1, #str
  while i <= len do
    local char = sub(str, i, i)
    -- token separator
    if char == '\31' then
      if is_on_key then
        is_on_key = false
      else
        tab[tonum(key) or key] = val
        reset()
      end
    -- subtable start
    elseif char == '\29' then
      local j,c = i,''
      -- checking for subtable end character
      while (c ~= '\30') do
        j = j + 1
        c = sub(str, j, j)
      end
      tab[tonum(key) or key] = table_from_string(sub(str,i+1,j-1))
      reset()
      i = j
    else
      if is_on_key then
        key = key..char
      else
        val = val..char
      end
    end
    i = i + 1
  end
  return tab
end

my_table=
table_from_string(
 '1�and�2�indexed�3�data�4�as�well��hello�world�nested�inside_of�here�some�data\'s nested��'
)

Clearly it's more helpful if your data table is much larger than this. In my case, my data tables took up almost 200 tokens, and I saved about 50 using this technique. If I go to add more translations in the future, it will save even more.

https://github.com/benwiley4000/pico8-table-string

P#64776 2019-05-27 07:03 ( Edited 2019-05-27 07:05)
[ :: Read More :: ]

Cart #isaac_oneshot-1 | 2019-05-26 | Code ▽ | Embed ▽ | No License
3

Isaac: a space shooter

This is my first Pico-8 game. I made this as part of a school project, and this is the definite version for that project. If I get more time on my hands, I want to take it further and make it a lot more interesting! Right now it features procedurally generated terrain, enemies, lasers and barrel rolls.

Controls:

Left and Right Arrows: move
Z: shoot
X: do a barrel roll

Gameplay:

Progress and shoot enemies to earn points. Don't hit the asteroid terrain or get hit by enemy lasers. Simple enough.

P#64770 2019-05-26 22:48
[ :: Read More :: ]

Cart #point_cloud_ladybug-0 | 2019-05-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
37

I took a shot at "demaking" an image made by Inigo Quilez. His original piece draws an animated scene which is modeled and rendered entirely by code which runs on the GPU (note: this link takes you to a webpage which runs heavy GPU code, and it will likely slow down your browser while it's running): https://www.shadertoy.com/view/4tByz3

My version is a lot simpler. It draws a single still image in two passes (first a depth/material-ID pass, then a lighting pass to get the final result), so be patient! Nothing else happens after it finishes drawing the image.

Unlike the original version, which uses Signed Distance Field modeling to describe its shapes, I used a point-cloud generator/rasterizer which uses a z-buffer for sorting (very similar to the triangle-renderers used in almost all current 3D game engines, but it only draws points instead of triangles). Each object on the screen is created by some function which submits a sequence of 3D positions with material values to to the rasterizer.

All lighting operations (diffuse + specular + approximated directional shadows + SSAO) are performed as a post-process, like deferred rendering in modern environments. Since the shapes in the scene are just arbitrary collections of points, they don't have "real" normals - instead, all normals are approximated based on the depth buffer, after all the points have been rasterized.

P#64769 2019-05-26 21:17 ( Edited 2019-05-26 21:20)
[ :: Read More :: ]

Cart #flip_out-0 | 2019-05-26 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
14

FLIP OUT, a clone of Voltorb Flip, a minigame from Pokémon HG/SS. It's like a cross between Minesweeper and Picross. Flip tiles to multiply your score, but don't hit a bomb and FLIP OUT. This is my first finished game. Check it out and let me know what you think!

Controls

Use the arrow keys to move the cursor. Press "Z" to flip or flag the selected tile. Press "X" to cycle through actions. The indicator on the right shows what action you have selected ("Flip" or "Flag").

You can also use your mouse to play. Left-click on a tile to flip it. Left-click on the flag buttons on the right side of the screen to flag the selected tile.

Guide

Each level, you will see a 5x5 grid of tiles. Each row and column has two numbers associated with it. The yellow number is the sum of all the points in that row/column. The red number is the number of bombs in that row/column.

Example:

This row has 3 bombs in it, and the rest of the tiles add up to 4 points. It could be two "2"s, or a "3" and a "1".

Cross-reference the row and column numbers to flip over the tiles you think do not have bombs. Each non-bomb tile multiplies your current score. When you have flipped over all the "2"s and "3"s, the level ends and you advance to the next level. Can you make it all the way to level 8?

Flagging

Like Minesweeper, you can flag tiles to keep track of what might be under them.

Example:

Here, I've marked every tile in this row with a bomb and a "1". Because the points and bombs for this row add up to 5, there can be no "2"s or "3"s. As you go through each row and column, you will be able to narrow down the options until you can decide which tiles to flip.

Credits

  • Game Freak and Nintendo for the game concept.
  • Discord user Junko#4218 for the amazing transcription of the original Voltorb Flip music to PICO-8.
  • @sighack for the bomb sprite from pico8.io

Check it out on itch.io

Follow me on twitter

P#64768 2019-05-26 20:28
[ :: Read More :: ]

Here's a simple tool I made for converting PICO-8-style Lua syntax into standard Lua syntax which allows you to run code analysis tools created for Lua. It's a thin wrapper around a converter function I took from PICOLOVE.

https://github.com/benwiley4000/pico8-to-lua

P#64758 2019-05-26 06:41
[ :: Read More :: ]

So I was working on the map in PICO-8 when I found some tiles I never placed, so I started erasing them. Later I saw a chunk of my spritesheet was erased, so I fixed that manually. Later the same thing happened and found that the tiles are related to the colors in the sprites. Why is this?

P#64747 2019-05-25 20:40
[ :: Read More :: ]
P#64744 2019-05-25 16:36
[ :: Read More :: ]

My first pico-8 cartridge is a little math experiment. It's possible to create a Sierpinski triangle fractal by repeatedly moving a point 1/3 of the way towards one of three points, chosen at random. The concept is explained in this video:

I got to playing with this idea, and ended up with the fractal you see below. It's got weird sword like protrusions, which is why I called it 'sword-pinski'

Of course the best way to enjoy it is to modify the code and see what happens :-)

Cart #sword_pinski-1 | 2019-05-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA

P#64743 2019-05-25 16:35 ( Edited 2019-05-25 16:38)
[ :: Read More :: ]

Cart #clausquest-4 | 2020-12-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
12

This is my first attempt at a game, using Adv. Micro Platformer by @mhughson and The Lich King by @dollarone as a template. This game came about as a gift to a friend (Claus, obviously) for his birthday. Consider it a WIP, as there is no way to actually win the game.

I would greatly appreciate any help on these matters:

--Set health for different bosses.

--Knockback when taking damage, both for bosses and the player.

P#64740 2019-05-25 15:31 ( Edited 2020-12-23 20:58)
[ :: Read More :: ]

[sfx]

Hollow Knight Main Theme Arrangement

Hi all!

I've made another PICO8 music arrangement. This time of Hollow Knight's main theme, originally made by Christopher Larkin.

Cartridge

Here is also the cartridge, in case you want to check it out:

Cart #hollowknightmaintheme-0 | 2019-05-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
10

P#64735 2019-05-25 11:46
[ :: Read More :: ]

Cart #tomytron-0 | 2019-05-25 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
6


Tomy Tron 0.1
De-make/Conversion of Tomy's Tron game.
This version still needs a little work, but its playable.
3 levels:
Light cycles level, make enemy crash into trail.
Discus level, get your discus past Sark.
Tower level, destroy the core.
Hope you have fun with it, i'll be updating it to 1.0 next week. Cheers.

P#64734 2019-05-25 08:49
[ :: Read More :: ]

[sfx]

Hi all!

I've made an arrangement for Pallet Town theme of Pokemon series into a PICO8 version.

I hope you like it!

Cheers! :D


All rights to Nintendo ©

P#64718 2019-05-24 18:19 ( Edited 2019-05-25 11:48)
[ :: Read More :: ]

Cart #hudidubuwe-0 | 2019-05-24 | Code ▽ | Embed ▽ | No License

school project just for saving so it doesnt get lost

P#64714 2019-05-24 10:33
[ :: Read More :: ]

Cart #sun_protection_force-0 | 2019-05-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
1

As the sun, you must protect the people of the earth from getting horrible sunburns! Move the sun to keep your friends in the shade, else they turn to a pile of ash.

Use the mouse for this game

A game by Kyle Neubarth and Madeline Lamee for game studio 2019

P#64701 2019-05-23 17:26 ( Edited 2019-05-23 17:40)
[ :: Read More :: ]

Cart #mb_simplegame-0 | 2019-05-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

This is a VERY simple game for very young kids to edit. This was literally coded in an hour, so it's not optimized or super clean code or anything like that. It just works and is easy for kids to edit. :) It's intended for kids to edit the sprites, sounds, and game variables.

Enjoy! :)

WHAT TO EDIT

SPRITES

Player - Sprite 1 and 2 are the player sprite.

Pickups - There are two rows of pickups. The top row gets only little_points if they are picked up. The bottom row gets big_points if they are picked up.

Baddies - These are sprites 49 and 50 (bottom-left of sprite tab 0).

Stars - The 4 pixels in sprite 48 (bottom-left) define the star colors.

SOUNDS

Sound 0 - When a top row pickup gets picked up.

Sound 1 - When a bottom row pickup gets picked up.

Sound 2 - When the player hits a baddie.

VARIABLES

little_points - Points gotten from picking up a top-row pickup.

big_points - Points gotten from picking up a bottom-row pickup.

game_speed - How fast the overall game should go.

player_speed - How fast the player moves.

animation_speed - How fast the animations change.

seconds_between_pickups - Self-explanatory.

seconds_between_baddies - Self-explanatory.

sky_color - Self-explanatory.

number_of_stars - Self-explanatory.

P#64691 2019-05-23 09:08
[ :: Read More :: ]

Cart #dehobigezu-0 | 2019-05-23 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
2

This is a late entry for the Tweet Tweet Jam from last week. I know, I know...but hey, I had a marathon of meetings at work so I made good use of the time.

Nonetheless, here it is. A simple little game inspired by the Tank & Plane LCD game I had as kid. Try to get the people from one side into the house while avoiding the Evil Cat Lord's love. But mind the gate, it blocks you until it goes down. See how many people you can save before you're hit (or get stuck).

Believe it or not, this is my first tweetcart (or close to it). I see the tweetcarts fly by on Twitter all day long but never really bothered to try one myself. I guess all the "art" carts aren't really my jam and I find myself at a loss when it comes to the math and magic behind making them.

Keeping things within the two tweet limit of 560 characters was quite the challenge. I took advantage of P8's wonderful symbol set and all-in-all, I'm pretty happy I was able to get things boiled down. I learned a lot and took advantage of a few shortcuts I had since forgotten or didn't know prior. I can probably go back through some full game carts and save a ton of extra space/tokens after what I've learned.

P#64686 2019-05-23 01:22 ( Edited 2024-04-30 18:49)
[ :: Read More :: ]

Cart #grenayino-0 | 2019-05-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
9

Yet another plasma demo! I've been meaning to implement this classic demo effect for years. Thanks to PICO-8 (which I've only just discovered!) I finally got around to it.

I created a continuous wrap around palette from the seven rainbow colours so I can cycle the palette continuously. I implemented these as sprites so I didn't have to mess around dithering, etc in the code.

Thanks to @rez for idea of each "pixel" being a 2x2 image.

Loads of room for improvement, but I'm pretty happy with this as a first attempt.

P#64682 2019-05-22 23:15
[ :: Read More :: ]

When PICO-8 launches now on my Mac, it no longer sizes itself appropriately so that it fills a window. It used to fill roughly 1/5th or so of the screen at a nice size that was not too small or too large and the 128x128 display would fit a square window. Now it is a smaller sized display with a lot of black letterboxing around it.

The latest build continues to work properly on windows, I'm only seeing this on Mac.

I did already try to delete the plist file associated with PICO-8, in case it was a local caching issue due to me derping with window resizing, but it continues to launch like this.

P#64680 2019-05-22 21:02 ( Edited 2019-05-22 21:03)
[ :: Read More :: ]

Here's the shortened tweet version:

b=0k=128
s=sin
c=cos::::cb=c(b)sb=s(b)q=5+sb1.8
b+=.007srand(0)cls()for i=1,500 do
f=-1+rnd(2)r=sqrt(1-f
f)p=rnd(1)d=rc(p)y=rs(p)x=dcb-fsb
z=dsb+fcb
e=y
f=z
y=ecb-fsb
z=esb+fcb
g=7-(z+.5)x=q(x+sb.4)y=q(y+s(b1.5).4)z=zq-20pset(x/zk+64,y/zk+64,g)end
flip()goto

https://twitter.com/DrewesThorsten/status/1130513256097955841

Cart #td_3ddots-0 | 2019-05-22 | Code ▽ | Embed ▽ | License: CC4-BY-NC-SA
7

P#64669 2019-05-22 05:56
[ :: Read More :: ]

Cart #twinbeeclone-0 | 2019-05-21 | Code ▽ | Embed ▽ | No License

Beginner here, so forgive me if I'm missing something obvious. I'm currently working on a simple clone of Twin Bee to learn a little bit about design. I'm running into a blockade due to my lack of programming experience, so I'm hoping someone may have some answers from me.

I've got clouds that fall from the top of the screen. The function that sets all the variables for the cloud table looks like this:

function spawncloud()
 local c = {
  x = rnd(95)+16,
  y = -16,
  dy = rnd(.5)+.75,
  sp = 5,
  hb = {x1=0,y1=0,x2=13,y2=1}
 }
 -- bell properties - is it necessary for me to declare
 -- these properties within the spawncloud function
 -- because the bell position depends on the cloud position? 
 local b = {
  x=c.x,
  y=c.y,
  boost=3,
  dy=0,
  sp=7,
  hb={x1=0,y1=0,x2=3,y2=3}
 }
 --add to cloud table
 add(clouds,c)
 --add to bell table
 add(bells, b)
end

The cloud spawn perfectly when I iterate through the cloud array in the _draw() function.

My next objective is spawning a bell when my bullet hit's one of these clouds. As you can see in the spawncloud() function above, I'm setting up a local table for the bells as well, because their x&y variables are dependent on those of the cloud. I would like to have an entirely separate spawnbell() function so I can call it when necessary, but I'm not quite sure how I would go about this because of the dependent x&y variables.

Additionally, my collision seems to be working about 75% of the time, so any help with making that more consistent would be greatly appreciated. I've borrowed the code from another project, so I'm not 100% clear on what it's doing. Here's what that code looks like:

--creating a box collider
function abs_box(s)
 local box = {}
 box.x1 = s.hb.x1 + s.x
 box.y1 = s.hb.y1 + s.y
 box.x2 = s.hb.x2 + s.x
 box.y2 = s.hb.y2 + s.y
 return box
end

--collision function
function coll(a,b)
 --create relative hitboxes
 local box_a = abs_box(a)
 local box_b = abs_box(b)

 if box_a.x1 > box_b.x2 or
    box_a.y1 > box_b.y2 or
    box_b.x1 > box_a.x2 or
    box_b.y1 > box_a.y2 then
    return false
  end
 return true
end

--check if our bullet is colliding
--with our cloud
function checkbulletcoll()
 for e in all(bullets) do
    for c in all(clouds) do
    if coll(e,c) then
    --delete bullet if collision
        del(bullets,e)
        end
    end
 end
end

Please let me know if there's additional code you'd like to see.
Thanks for the help!

P#64663 2019-05-22 00:06 ( Edited 2019-05-22 00:10)
View Older Posts